﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 字符串
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //string a = "Hello";
            //string b = "World";
            //Console.WriteLine(string.Concat(a, b));

            //string[] a = { "1", "2", "3", "4" };
            //Console.WriteLine(string.Join("-", a));

            //string s = "";
            //if(string.IsNullOrEmpty(s))
            //{
            //    Console.WriteLine("字符串s为空字符串或者null");
            //}

            //string s = "张三是个好人";
            //if (s.Contains("张三"))
            //{
            //    Console.WriteLine("字符串s包含张三这个字符串");
            //}

            //string s = "李四是个坏人, 李四";
            //Console.WriteLine(s.IndexOf("李四"));

            //string s = "李四是个坏人, 李四";
            //Console.WriteLine(s.LastIndexOf("李四"));

            //string str1 = "cat";
            //string str2 = "c";

            ////判断当前字符串是否以指定的字符串开始
            //bool a = str1.StartsWith(str2);//True
            //Console.WriteLine(a);

            //    string str1 = "cat";
            //    string str2 = "at";

            //    //判断当前字符串是否以指定的字符串结束
            //    bool a = str1.EndsWith(str2);//True
            //    Console.WriteLine(a);

            //string str1 = "Html Java C++";

            ////在当前字符串中替换所有指定的子字符串
            //string a = str1.Replace("Html", "C#");//C# Java C++
            //Console.WriteLine(a);

            //string str = "one,two,three";

            ////将当前字符串按照字符,进行分割
            //string[] strs = str.Split(','); // ["one", "two", "three"]
            //foreach(string s in strs)
            //{
            //    Console.Write(s + " ");
            //}
            //Console.WriteLine();

            //StringBuilder stringBuilder = new StringBuilder();
            //stringBuilder.Append("Hello");
            //Console.WriteLine(stringBuilder);
            //stringBuilder.Insert(1, "d");
            //Console.WriteLine(stringBuilder);
            //stringBuilder.Remove(1, 1);
            //Console.WriteLine(stringBuilder);
            //stringBuilder.Replace("o", "abc");
            //string s = stringBuilder.ToString();
            //Console.WriteLine(stringBuilder);
        }
    }
}
